package com.netrust.cmsx.admin.modules.sys.pojo;


import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.netrust.cmsx.core.persist.TreeEntity;
import com.netrust.cmsx.utils.collections.CollectionUtils;

@JsonIgnoreProperties(value={"name","pid","pids","type","target","sort","isShow","delFlag","permission","parent","children","expanded","isLeaf","level"}) 
public class MenuBto extends TreeEntity<MenuBto>{

	private static final long serialVersionUID = -5706038233713795248L;
	
	private String pids; // 所有父级编号
	
	private String name; 	// 名称
	
	private String href; 	// 链接
	
	private String type; 	// 类型  menu/permission
	
	private String target; 	// 目标（ mainFrame、_blank、_self、_parent、_top）
	
	private String icon; 	// 图标
	
	private Integer sort; 	// 排序
	
	private boolean isShow; 	// 是否在菜单中显示（true：显示；false：不显示）
	
	private String permission; // 权限标识

	private boolean delFlag;//删除标识 （true：已删除；false：未删除）

	private String text; // bootstrap tree 专用

	private String[] tags; // bootstrap tree 专用
	
	private List<MenuBto> nodes; // bootstrap tree 专用

	public String getPids() {
		return pids;
	}

	public void setPids(String pids) {
		this.pids = pids;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getHref() {
		return href;
	}

	public void setHref(String href) {
		this.href = href;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getTarget() {
		return target;
	}

	public void setTarget(String target) {
		this.target = target;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}

	public boolean getIsShow() {
		return isShow;
	}

	public void setIsShow(boolean isShow) {
		this.isShow = isShow;
	}

	public String getPermission() {
		return permission;
	}

	public void setPermission(String permission) {
		this.permission = permission;
	}

	public boolean isDelFlag() {
		return delFlag;
	}

	public void setDelFlag(boolean delFlag) {
		this.delFlag = delFlag;
	}
	
	public String getText() {
		return name;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String[] getTags() {
		if(CollectionUtils.isNotEmpty(super.children)){
			return new String[]{super.children.size()+""};
		}
		return new String[]{"0"};
	}

	public void setTags(String[] tags) {
		this.tags = tags;
	}

	public List<MenuBto> getNodes() {
		return super.children;
	}

	public void setNodes(List<MenuBto> nodes) {
		this.nodes = nodes;
	}

	@Override
	public String toString() {
		return "MenuPo [pids=" + pids + ", name=" + name + ", href=" + href + ", type=" + type + ", target=" + target
				+ ", icon=" + icon + ", sort=" + sort + ", isShow=" + isShow + ", permission=" + permission
				+ ", delFlag=" + delFlag + "]";
	}
	
	
}
